package io.github.mayubao.kotlintest

import org.junit.Assert.assertEquals
import org.junit.Test

class Day6_GetterAndSetterTest{

    @Test
    fun testGetterAndSetter(){
        var tt : T = T()
        tt.name = "github"
        assertEquals("GITHUBT", "${tt.name}")
    }


    class T{
        var id : Int = 0
        var name : String = ""
        set(value){
            println("before set name $value")
            field = value + "T"
        }
        get() = field.toUpperCase();
    }
}